import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:xin_nuo_pda/routes/Routes.dart';

import 'LoginController.dart';

class LoginPage extends StatelessWidget {
  final LoginController logic = Get.put(LoginController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        alignment: Alignment.center,
        children: [
          Container(
            color: Colors.white,
            padding: EdgeInsets.fromLTRB(60, 0, 60, 0),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Container(child: Text("芯诺科技",style: TextStyle(
                    fontSize: 36,
                    fontWeight: FontWeight.bold
                ),)),
                SizedBox(height: 40),
                Container(
                    height: 48,
                    child: TextField(
                      controller: logic.name,
                      decoration: InputDecoration(
                        hintText: "请输入用户名",
                      ),
                    )),
                SizedBox(height: 12),
                Container(
                    height: 48,
                    child: TextField(
                      obscureText: true,
                      controller: logic.passWord,
                      decoration: InputDecoration(
                        hintText: "请输入密码",
                      ),
                    )
                ),
                SizedBox(height: 24),
                Container(
                    height: 40,
                    width: double.infinity,
                    child: ElevatedButton(
                      onPressed: () {
                        logic.login();
                        // USER = logic.name.text;
                        // Get.offAllNamed(Routes.Tabs);
                      },
                      child: Text("登录"),
                    ))
              ],
            ),
          ),
          Positioned(
              right: 0,
              top: 18,
              child: IconButton(
                icon: Icon(
                  Icons.settings,
                  color: Colors.blue,
                ),
                onPressed: () {
                  Get.toNamed(Routes.Settings);
                },
              ))
        ],
      ),
    );
  }
}
